package study.cell_game.objects.borders;

import java.util.Arrays;
import java.util.HashMap;

import org.andengine.entity.particle.SpriteParticleSystem;
import org.andengine.entity.sprite.Sprite;

import study.cell_game.activity.GameActivity;
import study.cell_game.enums.Direction;
import study.cell_game.objects.textures.TokenTextures;

public class BorderFactory {

	public static Border createTriangularInOutBorder() {
		return createTriangularInOutBorder(0,0);
	}
	public static Border createTriangularInOutBorder(int X, int Y) {
		
		Sprite[] sprites = new Sprite[2];
		sprites[0] = new Sprite(X, Y, TokenTextures.getInstance().getTriangularInOutRot1(), GameActivity.main.getVertexBufferObjectManager());
		sprites[1] = new Sprite(X, Y, TokenTextures.getInstance().getTriangularInOutRot2(), GameActivity.main.getVertexBufferObjectManager());
		
		HashMap<Direction,Boolean>[] inbound = new HashMap[2]; //= new HashMap<Direction,Boolean>();
		inbound[0] = new HashMap<Direction,Boolean>();
		inbound[0].put(Direction.SOUTH, Boolean.FALSE);
		inbound[0].put(Direction.SOUTHEAST, Boolean.TRUE);
		inbound[0].put(Direction.SOUTHWEST, Boolean.TRUE);
		inbound[0].put(Direction.NORTH, Boolean.TRUE);
		inbound[0].put(Direction.NORTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.NORTHWEST, Boolean.FALSE);
		
		inbound[1] = new HashMap<Direction,Boolean>();
		inbound[1].put(Direction.SOUTH, Boolean.TRUE);
		inbound[1].put(Direction.SOUTHEAST, Boolean.FALSE);
		inbound[1].put(Direction.SOUTHWEST, Boolean.FALSE);
		inbound[1].put(Direction.NORTH, Boolean.FALSE);
		inbound[1].put(Direction.NORTHEAST, Boolean.TRUE);
		inbound[1].put(Direction.NORTHWEST, Boolean.TRUE);
		
		HashMap<Direction,Boolean>[] outbound = new HashMap[2];// = new HashMap<Direction,Boolean>();
		outbound[0] = new HashMap<Direction,Boolean>(inbound[0]);
		outbound[1] = new HashMap<Direction,Boolean>(inbound[1]);
		
		Border border = new Border(inbound, outbound, sprites);
		
		return border;
	}
	
	
	public static Border createTriangularInTriangularOutBorder() {
		return createTriangularInTriangularOutBorder(0,0);
	}
	
	public static Border createTriangularInTriangularOutBorder(int X, int Y) {
		
		Sprite[] sprites = new Sprite[2];
		sprites[0] = new Sprite(X, Y, TokenTextures.getInstance().getTriangleInTriangleOutRot1(), GameActivity.main.getVertexBufferObjectManager());
		sprites[1] = new Sprite(X, Y, TokenTextures.getInstance().getTriangleInTriangleOutRot2(), GameActivity.main.getVertexBufferObjectManager());
		
		HashMap<Direction,Boolean>[] inbound = new HashMap[2]; //= new HashMap<Direction,Boolean>();
		inbound[0] = new HashMap<Direction,Boolean>();
		inbound[0].put(Direction.SOUTH, Boolean.TRUE);
		inbound[0].put(Direction.SOUTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.SOUTHWEST, Boolean.FALSE);
		inbound[0].put(Direction.NORTH, Boolean.FALSE);
		inbound[0].put(Direction.NORTHEAST, Boolean.TRUE);
		inbound[0].put(Direction.NORTHWEST, Boolean.TRUE);
		
		inbound[1] = new HashMap<Direction,Boolean>();
		inbound[1].put(Direction.SOUTH, Boolean.FALSE);
		inbound[1].put(Direction.SOUTHEAST, Boolean.TRUE);
		inbound[1].put(Direction.SOUTHWEST, Boolean.TRUE);
		inbound[1].put(Direction.NORTH, Boolean.TRUE);
		inbound[1].put(Direction.NORTHEAST, Boolean.FALSE);
		inbound[1].put(Direction.NORTHWEST, Boolean.FALSE);
		
		HashMap<Direction,Boolean>[] outbound = new HashMap[2];// = new HashMap<Direction,Boolean>();
		outbound[0] = new HashMap<Direction,Boolean>(inbound[1]);
		outbound[1] = new HashMap<Direction,Boolean>(inbound[0]);
		
		Border border = new Border(inbound, outbound, sprites);
		
		return border;
	}
	
	public static Border createStraightInOutBorder() {
		return createStraightInOutBorder(0,0);
	}
		
	public static Border createStraightInOutBorder(int X, int Y) {
		
		Sprite[] sprites = new Sprite[3];
		sprites[0] = new Sprite(X, Y, TokenTextures.getInstance().getStraightInOutRot1(), GameActivity.main.getVertexBufferObjectManager());
		sprites[1] = new Sprite(X, Y, TokenTextures.getInstance().getStraightInOutRot2(), GameActivity.main.getVertexBufferObjectManager());
		sprites[2] = new Sprite(X, Y, TokenTextures.getInstance().getStraightInOutRot3(), GameActivity.main.getVertexBufferObjectManager());
		
		HashMap<Direction,Boolean>[] inbound = new HashMap[3]; //= new HashMap<Direction,Boolean>();
		inbound[0] = new HashMap<Direction,Boolean>();
		inbound[0].put(Direction.SOUTH, Boolean.TRUE);
		inbound[0].put(Direction.SOUTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.SOUTHWEST, Boolean.FALSE);
		inbound[0].put(Direction.NORTH, Boolean.TRUE);
		inbound[0].put(Direction.NORTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.NORTHWEST, Boolean.FALSE);
		
		inbound[1] = new HashMap<Direction,Boolean>();
		inbound[1].put(Direction.SOUTH, Boolean.FALSE);
		inbound[1].put(Direction.SOUTHEAST, Boolean.TRUE);
		inbound[1].put(Direction.SOUTHWEST, Boolean.FALSE);
		inbound[1].put(Direction.NORTH, Boolean.FALSE);
		inbound[1].put(Direction.NORTHEAST, Boolean.FALSE);
		inbound[1].put(Direction.NORTHWEST, Boolean.TRUE);
		
		inbound[2] = new HashMap<Direction,Boolean>();
		inbound[2].put(Direction.SOUTH, Boolean.FALSE);
		inbound[2].put(Direction.SOUTHEAST, Boolean.FALSE);
		inbound[2].put(Direction.SOUTHWEST, Boolean.TRUE);
		inbound[2].put(Direction.NORTH, Boolean.FALSE);
		inbound[2].put(Direction.NORTHEAST, Boolean.TRUE);
		inbound[2].put(Direction.NORTHWEST, Boolean.FALSE);
		
		
		HashMap<Direction,Boolean>[] outbound = new HashMap[3];// = new HashMap<Direction,Boolean>();
		outbound[0] = new HashMap<Direction,Boolean>(inbound[0]);
		outbound[1] = new HashMap<Direction,Boolean>(inbound[1]);
		outbound[2] = new HashMap<Direction,Boolean>(inbound[2]);
		
		Border border = new Border(inbound, outbound, sprites);
		
		return border;
	}
	
	public static Border createFullBorder(){
		return createFullBorder(0,0);
	}
	
	public static Border createFullBorder(int X, int Y){
		Sprite[] sprites = new Sprite[1];
		sprites[0] = new Sprite(X, Y, TokenTextures.getInstance().getFullRing(), GameActivity.main.getVertexBufferObjectManager());
		
		
		HashMap<Direction,Boolean>[] inbound = new HashMap[1]; //= new HashMap<Direction,Boolean>();
		inbound[0] = new HashMap<Direction,Boolean>();
		inbound[0].put(Direction.SOUTH, Boolean.FALSE);
		inbound[0].put(Direction.SOUTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.SOUTHWEST, Boolean.FALSE);
		inbound[0].put(Direction.NORTH, Boolean.FALSE);
		inbound[0].put(Direction.NORTHEAST, Boolean.FALSE);
		inbound[0].put(Direction.NORTHWEST, Boolean.FALSE);
		
		HashMap<Direction,Boolean>[] outbound = new HashMap[1];// = new HashMap<Direction,Boolean>();
		outbound[0] = new HashMap<Direction,Boolean>(inbound[0]);
		
		Border border = new Border(inbound, outbound, sprites);
		
		return border;
	}

}
